package com.hns.can.mainte.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.hns.can.common.constants.GlobalConst;
import com.hns.can.common.formula.FillCodeDscValue;
import com.hns.can.common.formula.FillParamsVo;
import com.hns.can.mainte.entity.CommCoinBoxInfoEntity;
import com.hns.can.mainte.vo.SlotMachineVo;
import com.hns.frame.service.CommonService;
import com.hns.tool.pub.PubUtil;

/**
 * 投币箱Service
 * @author:zhangzq
 * @email:
 * @version Revision 2.0.0
 */
@Service
public class SlotMachineService extends CommonService {
	
    @Autowired
    private FillCodeDscValue codeDscValue;

    private void fillInfoValue(List list) throws Exception {
        Map<String,String> map = new HashMap<String,String>();
        map.put("licPltNo", GlobalConst.DEFAULT_CACHE_VALUE);
        FillParamsVo vo = new FillParamsVo("carId", map);
        codeDscValue.fillInfoValue(list,new String[]{GlobalConst.CACHE_KEY_BASE_CAR_INFO},vo);
    }

    /**
     * 查询投币箱
     * @param vo
     * @return
     * @throws Exception
     * @author:zhangzq
     * @email:
     */
    @SuppressWarnings({"unchecked", "static-access" })
    @Transactional
    public List<CommCoinBoxInfoEntity> getSlotMachineList(SlotMachineVo vo) throws Exception {
        List<CommCoinBoxInfoEntity> list = PubUtil.convertListMapToObject(sqlMapDao.selectList("slotMachine.searchSlotMachineList", vo), CommCoinBoxInfoEntity.class);
        fillInfoValue(list);
        return list;
    }
    
    /**
     * 投币箱明细
     * @param vo
     * @return
     * @throws Exception
     * @author:zhangzq
     * @email:
     */
    @SuppressWarnings({"unchecked", "static-access" })
    @Transactional
    public List<CommCoinBoxInfoEntity> getSlotMachineDetail(SlotMachineVo vo) throws Exception {
        List<CommCoinBoxInfoEntity> list = PubUtil.convertListMapToObject(sqlMapDao.selectList("slotMachine.searchSlotMachineDetail", vo), CommCoinBoxInfoEntity.class);
        fillInfoValue(list);
        return list;
    }
}